package com.community.service.impl;

import com.community.mapper.AdminElderlyHealthMapper;
import com.community.pojo.ElderlyHealth;
import com.community.service.AdminElderlyHealthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AdminElderlyHealthServiceImpl implements AdminElderlyHealthService {
    private final AdminElderlyHealthMapper adminElderlyHealthMapper;
    @Autowired
    public AdminElderlyHealthServiceImpl(AdminElderlyHealthMapper adminElderlyHealthMapper) {
        this.adminElderlyHealthMapper = adminElderlyHealthMapper;
    }

    public int addElderlyHealth(ElderlyHealth elderlyHealth) {
       int n= adminElderlyHealthMapper.addElderlyHealth(elderlyHealth);
       return n;
    }

    public ElderlyHealth findHealthById(Integer healthId){
        return adminElderlyHealthMapper.findHealthById(healthId);
    }

    public ElderlyHealth findElderlyHealthByuserId(Integer userId){
        return adminElderlyHealthMapper.findElderlyHealthByuserId(userId);
    }
    public int deleteElderlyHealth(Integer healthId){
        int n= adminElderlyHealthMapper.deleteElderlyHealth(healthId);
        return n;
    }

    public int deleteByUserId(Integer userId) {
        return adminElderlyHealthMapper.deleteByUserId(userId);
    }

    public int updateElderlyHealth(Double height,Integer age,Double weight,String healthCondition,Integer healthId){
        int n= adminElderlyHealthMapper.updateElderlyHealth(height,age,weight,healthCondition,healthId);
        return n;
    }


}
